cmake_minimum_required(VERSION 3.24)

project(executor VERSION 0.1.0  LANGUAGES C CXX)


set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# add_compile_definitions(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
add_compile_options( -fno-inline-functions)
# 查找Boost
find_package(Boost COMPONENTS context system thread serialization REQUIRED) # Asio作为Boost的一部分，通常需要system和thread组件


if(BUILD_TEST)
    add_definitions(-DBUILD_TEST)
endif()

# 递归查找当前目录及子目录下的所有 .cpp 文件
file(GLOB_RECURSE EXECUTOR_SOURCES "./src/*.cc")

# 添加执行目标
add_library(${PROJECT_NAME} STATIC ${EXECUTOR_SOURCES})

message(STATUS "!!!!!!!!!! " ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${PROJECT_NAME} PUBLIC
    ./include
    ${CMAKE_CURRENT_SOURCE_DIR}/../util/include
)
# 链接Boost.Asio
target_link_libraries(${PROJECT_NAME} PUBLIC
    ${Boost_LIBRARIES}
    yaml-cpp
    tbb
    util
    asio::asio
)
